package com.swanclouds.redfish.internal;

import com.swanclouds.api.types.ServiceType;
import com.swanclouds.core.transport.ClientConstants;
import com.swanclouds.model.common.redfish.CollectionResource;
import com.swanclouds.redfish.common.redfish.CollectionResourceModel;

/**
 *  * Description:
 *  * Author:      zhangliqiang@asiacom.net.cn
 *  * Date:        2022-07-16 10:26.
 *  
 */
public class BaseChassisService extends BaseRedfishService {

    public BaseChassisService() {
        super(ServiceType.CHASSIS);
    }

    private static ThreadLocal<String> chassisContainer = new ThreadLocal<>();

    public String getChassisId() {
        if (chassisContainer.get() != null) {
            return chassisContainer.get();
        }
        CollectionResource resource = get(CollectionResourceModel.class, uri(ClientConstants.PATH_CHASSIS)).execute();
        return getResourceId(resource, chassisContainer);
    }

}
